package com.qf.rabbitMQ.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 郗昊天
 * @version 1.0
 * @package com.qf.rabbitMQ.config
 * @date 2022/10/15 10:46
 */
@Configuration
public class MqConfig {

    @Bean
    public Queue xhtQueue(){
        //xht是
        return new Queue("xht",false,false,false,null);
    }

    @Bean
    public Queue fanoutQueue1(){
        return new Queue("fanoutQueue04",false,false,false,null);
    }

//    @Bean
//    public Queue fanoutQueue2(){
//        return new Queue("fanoutQueue2",false,false,false,null);
//    }


    @Bean
    public FanoutExchange fanoutExchange() {
        return new FanoutExchange("springbootfanout04",false,false);
    }

    @Bean
    public Binding bindQueue(Queue fanoutQueue1,FanoutExchange fanoutExchange){
        return BindingBuilder.bind(fanoutQueue1).to(fanoutExchange);
    }
}
